<h1>Listing chapters</h1>

<table>
  <tr>
    <th>Title</th>
    <th>Order</th>
    <th>Book</th>
    <th>Num of pages</th>
  </tr>

<% for chapter in @chapters %>
  <tr>
    <td><%=h chapter.title %></td>
    <td><%=h chapter.order %></td>
    <td><%=h chapter.book_id %></td>
    <td><%=h chapter.num_of_pages %></td>
    <td><%= link_to 'Show', book_chapter_path(chapter.book, chapter) %></td>
    <td><%= link_to 'Edit', edit_book_chapter_path(chapter.book, chapter) %></td>
    <td><%= link_to 'Destroy', book_chapter_path(chapter.book, chapter), :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New chapter', new_book_chapter_path(@book) %>
